#Makefile for creating doas distributions

all: wrappers
	@echo "Building..."
	python setup.py build

dist: wrappers
	@echo "Creating source dist"
	python setup.py sdist

.PHONY: wrappers
wrappers:
	@echo "Creating wrapper code using SWIG"
	swig -python src/swig/shift_and_squeeze.i
	swig -python src/swig/fitting.i
	
	@echo "Moving resulting .py files into doas package"
	mv src/swig/shift_and_squeeze.py src/doas/
	mv src/swig/_fitting_base.py src/doas/
    

clean:
	@echo "Removing build dir"
	rm -rf build
	@echo "Removing dist dir"
	rm -rf dist
	@echo "Removing MANIFEST file"
	rm -f MANIFEST
	@echo "Removing old wrapper modules"
	rm -f src/doas/shift_and_squeeze.py
	rm -f src/doas/_shift_and_squeeze.so
	rm -f src/doas/_fitting_base.py
	rm -f src/doas/_fitting.so
	@echo "Removing old object files and swig-generated source files"
	rm -f src/swig/*.o
	rm -f src/swig/*.so
	rm -f src/swig/*_wrap.c
	rm -f src/swig/*.py
    